﻿#region FileHeader
//////////////////////////////////////////////////////////////////////////////////
// Author:                          Hector Llanos
// Date:                            03.19.2011
// FileName:                        CMathLib.cs
// Reason:                          static math library
//////////////////////////////////////////////////////////////////////////////////
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Math
{
    public static class CMathLib
    {
      public static  Vector2 Vector2DRotate(Vector2 vec, float fRadians)
        {
            //	Convert into the Cartesian coordinate system
            vec.Y *= -1.0f;

            Vector2 vRotated;
            vRotated.X = ((float)System.Math.Cos(fRadians) * vec.X) + ((float)System.Math.Sin(fRadians) * vec.Y);
            vRotated.Y = ((float)-System.Math.Sin(fRadians) * vec.X) + ((float)System.Math.Cos(fRadians) * vec.Y);

            //	Convert back to our windows coordinate system
            vRotated.Y *= -1.0f;

            //	Return our rotated vector
            return vRotated;
        }
    }
}
